"""推理引擎抽象基类"""
from abc import ABC, abstractmethod
import numpy as np
from typing import Union, List

class InferenceEngine(ABC):
    """推理引擎抽象基类"""
    
    def __init__(self, model_path: str):
        self.model_path = model_path
        self._initialize()
    
    @abstractmethod
    def _initialize(self):
        """初始化推理引擎"""
        pass
    
    @abstractmethod
    def infer(self, input_data: np.ndarray) -> Union[np.ndarray, List[np.ndarray]]:
        """执行推理"""
        pass
    
    @abstractmethod
    def get_input_shape(self) -> tuple:
        """获取输入形状"""
        pass
    
    @abstractmethod
    def get_input_dtype(self) -> np.dtype:
        """获取输入数据类型"""
        pass